<%--
  Created by IntelliJ IDEA.
  User: 羽
  Date: 2015/10/25
  Time: 11:08
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>

<head>

</head>
<body>
<style>
  form div{
    white-space:nowrap;
  }
</style>
<div class="pd-10">
  <div >
    <form id='registerform'action="<%=request.getContextPath()%>/back/park/edit.do" method="post" class="form form-horizontal">
      <input type="hidden" id="unid"name="unid" />
      <div class="row cl">
        <label class="form-label col-3"><span class="c-red">*</span>编号：</label>
        <div class="formControls col-5 inline">
          <input type="text" class="input-text" id="code" name="code" datatype= "/^[0-9A-Za-z]{4,12}$/"ajaxurl="<%=request.getContextPath()%>/back/park/valid.do" errormsg="请填写4-12位数字或英文" >
        </div>

      </div>
      <div class="row cl">
        <label class="form-label col-3"><span class="c-red">*</span>姓名：</label>
        <div class="formControls col-5">
          <input type="text" class="input-text"  id="name" name="name" datatype="*3-12">
        </div>
        <div class="col-4"> </div>
      </div>
      <div class="row cl">
        <label class="form-label col-3">性别：</label>
        <div class="formControls col-5 skin-minimal">
          <div class="radio-box">
            <input type="radio"value="0" id="sex-1" name="sex" checked>
            <label for="sex-1">男</label>
          </div>&nbsp;&nbsp;&nbsp;
          <div class="radio-box">
            <input type="radio" value="1" id="sex-2" name="sex">
            <label for="sex-2">女</label>
          </div>
        </div>
        <div class="col-4"> </div>
      </div>
      <div class="row cl">
        <label class="form-label col-3">状态：</label>
        <div class="formControls col-5 skin-minimal">
          <div class="radio-box">
            <input type="radio" id="inoffice-1"value="0" name="inoffice" checked >
            <label for="sex-1">在职</label>
          </div>
          <div class="radio-box">
            <input type="radio" id="inoffice-2"value="1" name="inoffice">
            <label for="sex-2">离职</label>
          </div>
        </div>
        <div class="col-4"> </div>
      </div>
      <div class="row cl">
        <label class="form-label col-3">手机：</label>
        <div class="formControls col-5">
          <input ignore="ignore" type="text" class="input-text"  id="cellphone" name="cellphone"  datatype="m" >
        </div>
        <div class="col-4"> </div>
      </div>
      <div class="row cl">
        <label class="form-label col-3">邮箱：</label>
        <div class="formControls col-5">
          <input type="text" class="input-text"  name="email" id="email" datatype="e" ignore="ignore">
        </div>
        <div class="col-4"> </div>
      </div>
      <div class="row cl">
        <label class="form-label col-3">入职日期：</label>
        <div class="formControls col-5">
          <input  ignore="ignore" id="createdate" name='createdate'class="Wdate input-text" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd',maxDate:'%y-%M-%d'})" />
        </div>
        <div class="col-3"> </div>
      </div>
      <div class="row cl">
        <label class="form-label col-3">部门：</label>
        <div class="formControls col-5"> <span class="select-box">
        <select class="select" size="1"id="departid" name="departid" datatype="*" nullmsg="请选择所在部门！">
        </select>
        </span> </div>
        <div class="col-4"> </div>
      </div>

      <div class="row cl" style="margin-top:25px">
        <div class="col-9 col-offset-3">

          <button class="btn btn-primary radius" id="submitBtn"> 确定</button>&nbsp;&nbsp;&nbsp;
          <button class="btn  radius" type='reset'> 重置</button>&nbsp;&nbsp;&nbsp;
        </div>
      </div>
    </form>
  </div>
</div>
</body>
</html>
<%@include file="../../head-ui.jsp"%>
<script type="text/javascript">
  $(function(){



    $('.skin-minimal input').iCheck({
      checkboxClass: 'icheckbox-blue',
      radioClass: 'iradio-blue',
      increaseArea: '20%'
    });
    if('${type}'=='edit'){
      $("#unid").val('${user.unid}');
      $("#code").val('${user.code}');
      $("#code").attr("disabled",'true');
      $("#name").val('${user.name}');
      $("#sex").val('${user.sex}');
      $("#cellphone").val('${user.cellphone}');
      $("#createdate").val('${user.createdate}');
      $("#inoffice").val('${user.inoffice}');
      if( $("#departid").html().trim()!=""){
        $("#departid").val('${user.departid}');
      }else{
        setTimeout(function(){
          $("#departid").val('${user.departid}');
        },2500);
      }
    }else{
      //var time1 = new Date().format("yyyy-MM-dd HH:mm:ss");
      $("#createdate").val(formatDate(new Date(),"yyyy-MM-dd"));
    }

    var form=$("#registerform").Validform({
      tiptype:3,
      callback:function(data){

        if(data.message=="false"){
          layer.msg('保存失败!',{icon: 1,time:1000});

        }else{
          layer.alert('保存成功!', {
            icon: 1,//2表示保存失败图标，1表示保存成功
            closeBtn:false,
            shadeClose: true,
            title: "提示"
          }, function(){

            layer_close();
          });
          //layer.msg('保存成功!',{icon: 1,time:1000});
          $("#uuid").val(data.uuid);
        }
      },
      ajaxPost:true,
      showAllError:true

    });

    $("#submitBtn").click(function(){
      form.submitForm(false);
    })





  })
</script>


